export function createImportSchema(title, api, templateUrl, linkLabel){
    return{
        title: title,
        closeOnEsc: true,
        showErrorMsg: false,
        body:{
            type: 'form',
            api: api,
            messages:{
                validateFailed:''
            },
            body:[
            {
                type: 'input-file',
                name: 'fileUrl',
                label: '上传文件',
                maxSize: 20971520,
                accept: '.xls,.xlsx',
                required: true,
                validationErrors: {
                    isRequired: '请上传文件'
                },
                receiver: '/base/file/upload',
                autoFill: {
                    fileId: '${fileId}',
                    fileUrl: '${url}'
                }
            },
            {
                type: 'control',
                label: '模板下载',
                body:{
                    type: 'action',
                    level: 'link',
                    actionType: 'url',
                    label: linkLabel ? linkLabel : '下载',
                    url: templateUrl,
                    visibleOn: '${'+ (templateUrl?true:false) +'}',
                },
            },
            {
                type: 'hidden',
                name: 'fileId'
            },
            {
                type: 'hidden',
                name: 'fileUrl'
            }]
        }
    }
}